//package com.fingard.dsp.bank.directbank.ccb04;
//
//import java.io.File;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.Map;
//
//import com.fingard.dsp.bank.directbank.bankInterface.IBalance;
//import com.fingard.dsp.bank.reqrespobj.balance.Req7505HisBalQry;
//import com.fingard.dsp.bank.reqrespobj.balance.Req7506BalQry;
//import com.fingard.dsp.bank.reqrespobj.balance.RetAts7505HisBalQry;
//import com.fingard.dsp.bank.reqrespobj.balance.RetAts7506BalQry;
//import com.fingard.dsp.bank.reqrespobj.balance.detail.RetAtsBalDetail;
//import com.fingard.dsp.bank.reqrespobj.balance.detail.RetAtsHisBalDetail;
//import com.fingard.dsp.bank.reqrespobj.enumeration.ENDirectRight;
//import com.fingard.text.StringHelper;
//import com.fingard.xml.XmlTextReader;
//import com.fingard.xml.XmlTextWriter;
//
//public class CCB04Balance extends CCB04Base implements IBalance {
//
//    //单个余额查询和批量余额查询，统一采用流处理方式
//    //1、循环调用Req7506BalQry.readRecord()读取一个请求明细，然后写入发银行的XML对象
//    //2、发银行
//    //3、循环调用XmlTextReader.read()读取一个银行返回节点，赋值返回ATS的明细对象，
//    //   然后调用RetAts7506BalQry.writeRetDetail()，写入返回ATS的明细
//    public RetAts7506BalQry d_7506_BalQry(Req7506BalQry p_req7506) throws Exception {//余额查询
//        //余额查询返回ATS的对象
//        if ("TRUE".equals(getBankConfig().getValueAsString("UseNewVersion").toUpperCase())) {
//            return d_7506_BalQryNew(p_req7506);
//        }
//        RetAts7506BalQry retAts = new RetAts7506BalQry(p_req7506.reqHeader);
//        retAts.writeStart();//写返回ATS的统一头部信息
//        try {
//            //查询之前做登录操作 下载公钥密钥 进行3des加密 和md5withRSA签名 byte[]数据和String进行base64互转
//            getBnkToken();
////            if (triDesKeys != null && triDesKeys.length != 1024) {
//            if (StringHelper.hasAnyChar(bankFront.token)) {
//                if (new File(String.format("%1$s%2$s_BnkPubKey.txt", strtmpFile, bankFront.org)).exists()) {
//                    if (!"".equals(bankFront.loginFlag) && !"false".equals(bankFront.loginFlag)) {
//                        //赋值通用参数
//                        txCode = "P1CMSER43";
//                        reqSeqID = p_req7506.reqHeader.transSeqID;
//                        XmlTextWriter xmlWriter = new XmlTextWriter();//发银行报文的XML对象
//                        XmlTextWriter xmlWriterWithoutCDATA = new XmlTextWriter();//发银行报文的XML对象
//                        //写入通用的头部节点
//                        writeCommonHeaderWithoutCDATA(xmlWriterWithoutCDATA);
//                        xmlWriterWithoutCDATA.writeStartElement("request");
//
//                        Date date = new Date();
//                        Map<Integer, Map<String, String>> mapList = new HashMap<Integer, Map<String, String>>();
//                        Map<String, String> map = new HashMap<String, String>();
//                        int count = 0;
//                        boolean isDirectRight=false;
//                        while (p_req7506.readRecord()) {
//                            count++;
//                            map.put("actNum", p_req7506.readedDetail.actNum);
//                            map.put("actCur", p_req7506.readedDetail.actCur);
//                            map.put("transSeqID", p_req7506.reqHeader.transSeqID);
//                            isDirectRight = p_req7506.readedDetail.directRight.contains(ENDirectRight.CASHPOOLS.getValue()) ? true : false;
//                            mapList.put(count, map);
//                            xmlWriterWithoutCDATA.writeElementString("Cst_AccNo", p_req7506.readedDetail.actNum);
//                            xmlWriterWithoutCDATA.writeElementString("CcyCd", convertCurToBank(p_req7506.readedDetail.actCur));
//                            xmlWriterWithoutCDATA.writeElementString("CshEx_Cd", "1".equals(p_req7506.readedDetail.actCur) ? "1" : "2");//钞汇代码 1钞人民币 2汇外币
//                            xmlWriterWithoutCDATA.writeElementString("ASPD_ECD", "00000886");//客户内部账户管理
//                            writeComEntityWithoutCDATA(xmlWriterWithoutCDATA);
//                        }
//                        xmlWriterWithoutCDATA.writeEndDocument();
//
//                        int n = xmlWriterWithoutCDATA.toXmlString().length();
//                        xmlLength = decimalFormat.format(n);
//
//                        writeCommonHeader(xmlWriter);
//                        xmlWriter.writeStartElement("request");
//                        for (int i = 0; i < count; i++) {
//                            xmlWriter.writeElementCDATA("Cst_AccNo", mapList.get(count).get("actNum"));
//                            xmlWriter.writeElementCDATA("CCstTr_ID", getBankConfig().getValueAsString("treeId"));
//                            xmlWriter.writeElementCDATA("CCstTrNdID", getBankConfig().getValueAsString("treeNdId"));
//                            xmlWriter.writeElementCDATA("CcyCd", convertCurToBank(mapList.get(count).get("actCur")));
//                            xmlWriter.writeElementCDATA("CshEx_Cd", "1".equals(mapList.get(count).get("actCur")) ? "1" : "2");//钞汇代码 1钞 2汇
//                            xmlWriter.writeElementCDATA("ASPD_ECD", "00000886");////客户内部账户管理
//                            writeComEntity(xmlWriter);
//                        }
//                        xmlWriter.writeEndDocument();
//                        String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
//                        if (tmpStrRet[0].length() == 0) {
//
//                            StringBuilder tmpSbMsg = new StringBuilder();
//                            XmlTextReader tmpBkReader = null;
//                            tmpBkReader = getBankInfo(tmpStrRet[1], tmpSbMsg);
//                            String xln_status = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_TX_STATUS"); // 服务状态
//                            String xln_resp_code = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_RESP_CODE"); // 服务响应码
//                            String xln_resp_desc = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_RESP_DESC"); // 服务响应描述
//                            if (IsResultInvlid(tmpStrRet[1], tmpBkReader, false, retAts)) {
//                                if (tmpBkReader != null) {
//                                    if ("00".equals(xln_status) && "000000000000".equals(xln_resp_code)){
//                                        //SYS_TX_STATUS 服务状态 00-成功01-失败02-不确
//                                        String tmpStatus = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_TX_STATUS");
//                                        //CshMgt_Txn_Rslt_Cd 现金管理交易结果代码 (0-无此交易，1-交易成功，2-交易失败，3-处理中)
//                                        String tmpCode = tmpBkReader.getFirstText("/Transaction/Transaction_Body/response/CshMgt_Txn_Rslt_Cd");
//                                        String tmpStatusText = tmpBkReader.getFirstText("/HZBANKB2C/ebank/common/retMsg");
//                                        while (tmpBkReader.read("/Transaction/Transaction_Body/response")) {
//                                            RetAtsBalDetail tmpRetDetail = new RetAtsBalDetail();
//                                            tmpRetDetail.respCode = "0";
//                                            tmpRetDetail.actCur = convertCurToATS(tmpBkReader.readedXElement.getSingleText("CcyCd"));
//                                            tmpRetDetail.actNum = tmpBkReader.readedXElement.getSingleText("Cst_AccNo");
//                                            tmpRetDetail.currBal = tmpBkReader.readedXElement.getSingleText("Dep_AcBa");
//                                            tmpRetDetail.availBal = tmpBkReader.readedXElement.getSingleText("Avl_Bal");
//                                            tmpRetDetail.frozenBal = tmpBkReader.readedXElement.getSingleText("Ord_Bsn_Frz_Amt");
//
//                                            //判断账号有现金池权限是，查询现金池余额接口
//                                            if(!p_req7506.isBatch && count == 1 && isDirectRight == true) {
//                                                qry7506CashPoolBal(mapList.get(1), tmpRetDetail);
//                                            }else {
//                                                WriteBankLogLn("未进入现金池余额查询:" + new Date());
//                                                WriteBankLogLn("count:" + count + "；isDirectRight：" + isDirectRight);
//                                            }
//                                            retAts.writeRetDetail(tmpRetDetail, p_req7506.isBatch);
//                                        }
//                                    }else {
//                                        retAts.writeRespCode("-1");
//                                        retAts.writeRespInfo(xln_status + xln_resp_code + xln_resp_desc);
//                                    }
//                                } else {
//                                    retAts.writeRespCode("-1");
//                                    retAts.writeRespInfo(tmpSbMsg.toString());
//                                }
//                            } else {
//                                retAts.writeRespCode("-1");
//                                retAts.writeRespInfo(xln_status + xln_resp_code + xln_resp_desc);
//                            }
//                        } else {
//                            retAts.writeRespCode("-1");
//                            retAts.writeRespInfo(tmpStrRet[1]);
//                        }
//
//
//                    } else {
//                        retAts.writeRespCode("-1");
//                        retAts.writeRespInfo("签到失败");
//                    }
//                } else {
//                    retAts.writeRespCode("-1");
//                    retAts.writeRespInfo("下载银行pub密钥失败");
//                }
//            } else {
//                retAts.writeRespCode("-1");
//                retAts.writeRespInfo("下载银行3des密钥失败");
//            }
//        } catch (Exception e) {
//            retAts.writeRespCode("-1");
//            retAts.writeRespInfo(e.getMessage());
//            e.printStackTrace();
//        }
//        retAts.writeEnd();
//        return retAts;
//    }
//
//    @Override
//    public RetAts7505HisBalQry d_7505_BalQry(Req7505HisBalQry p_req7505) throws Exception {
//        RetAts7505HisBalQry retAts = new RetAts7505HisBalQry(p_req7505.reqHeader);
//        String tmpRespCode = "";
//        String tmpRespInfo = "";
//        retAts.writeStart();//写返回ATS的统一头部信息
//        try {
//            getBnkToken();
////            if (triDesKeys != null && triDesKeys.length != 1024) {
//            if (StringHelper.hasAnyChar(bankFront.token)) {
//                if (new File(String.format("%1$s%2$s_BnkPubKey.txt", strtmpFile, bankFront.org)).exists()) {
//                    if (!"".equals(bankFront.loginFlag) && !"false".equals(bankFront.loginFlag)) {
//                        int tmpNowStartRecord = 0;//总条数
//                        int intPageNumber = 1;//页码数 默认查询第一页
//                        int tmpNowReadedCount = 0;//已读条数
//                        page = String.valueOf(intPageNumber);
//
//                        boolean tmpQryNext = true;
//                        while (tmpQryNext && tmpRespCode.length() == 0) {//分页查询
//                            tmpQryNext = false;
//                            //赋值通用参数
//                            txCode = "P1CMSERA6";
//                            reqSeqID = getQryTransID();
//                            XmlTextWriter xmlWriter = new XmlTextWriter();//发银行报文的XML对象
//                            XmlTextWriter xmlWriterWithoutCDATA = new XmlTextWriter();//发银行报文的XML对象
//                            //写入通用的头部节点
//                            writeCommonHeaderWithoutCDATA(xmlWriterWithoutCDATA);
//                            xmlWriterWithoutCDATA.writeStartElement("request");
//                            xmlWriterWithoutCDATA.writeElementString("AccNo", p_req7505.actNum);//账号
//                            xmlWriterWithoutCDATA.writeElementString("CcyCd", convertCurToBank(p_req7505.actCur));//币种代码
//                            xmlWriterWithoutCDATA.writeElementString("StDt", p_req7505.dateFrom);//开始日期
//                            xmlWriterWithoutCDATA.writeElementString("EdDt", p_req7505.dateTo);//结束日期
//                            xmlWriterWithoutCDATA.writeElementString("BkltNo", "");//存折册号
//                            xmlWriterWithoutCDATA.writeElementString("Dep_DepSeqNo", "");//存款笔号
//                            xmlWriterWithoutCDATA.writeElementString("ASPD_ECD", "00000886");//客户内部账户管理
//                            writeComEntityWithoutCDATA(xmlWriterWithoutCDATA);
//
//                            int n = xmlWriterWithoutCDATA.toXmlString().length();
//                            xmlLength = decimalFormat.format(n);
//
//                            writeCommonHeader(xmlWriter);
//                            xmlWriter.writeStartElement("request");
//                            xmlWriter.writeElementString("AccNo", p_req7505.actNum);//账号
//                            xmlWriter.writeElementString("CcyCd", convertCurToBank(p_req7505.actCur));//币种代码
//                            xmlWriter.writeElementString("StDt", p_req7505.dateFrom);//开始日期
//                            xmlWriter.writeElementString("EdDt", p_req7505.dateTo);//结束日期
//                            xmlWriter.writeElementString("BkltNo", "");//存折册号
//                            xmlWriter.writeElementString("Dep_DepSeqNo", "");//存款笔号
//                            xmlWriter.writeElementString("ASPD_ECD", "00000886");//客户内部账户管理
//                            writeComEntity(xmlWriter);
//                            xmlWriter.writeEndDocument();
//                            String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
//                            XmlTextReader tmpBkReader = null;
//                            StringBuilder tmpSbMsg = new StringBuilder();
//                            tmpBkReader = getBankInfo(tmpStrRet[1], tmpSbMsg);
//                            String xln_status = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_TX_STATUS"); // 服务状态
//                            String xln_resp_code = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_RESP_CODE"); // 服务响应码
//                            String xln_resp_desc = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_RESP_DESC"); // 服务响应描述
//                            if (tmpStrRet[0].length() == 0) {
//                                if (IsResultInvlid(tmpStrRet[1], tmpBkReader, false, retAts)) {
//
//                                    if (tmpBkReader != null) {
//                                        int recordNum = Integer.parseInt(tmpBkReader.getFirstText("/Transaction/Transaction_Body/response/TOTAL_REC"));
//                                        if (recordNum > 0) {
//                                            int tmpTotalRocords = 0;//总条数
////                                            int tmpPage = 0;
////                                            tmpPage = Integer.parseInt(tmpBkReader.getFirstText("/Transaction/Transaction_Body/response/TOTAL_PAGE"));
//                                            tmpTotalRocords = recordNum;
//                                            int tmpEachPiCount = 0;
//                                            while (tmpBkReader.read("/Transaction/Transaction_Body/response/LIST1")) {
//                                                tmpEachPiCount++;
//                                                RetAtsHisBalDetail tmpRetDetail = new RetAtsHisBalDetail();
//                                                String balDate = tmpBkReader.readedXElement.getSingleText("Txn_Dt");
//                                                tmpRetDetail.balDate = balDate.substring(0, 4) + "-" + balDate.substring(4, 6) + "-" + balDate.substring(6, 8);
//                                                tmpRetDetail.actBal = tmpBkReader.readedXElement.getSingleText("Bal");
//                                                retAts.writeRetDetail(tmpRetDetail);
//                                            }
//                                            tmpNowReadedCount += tmpEachPiCount;//总记录数
//                                            if (tmpNowReadedCount < tmpTotalRocords) {//查询下一页
//                                                intPageNumber = intPageNumber + 1;//页码加一 查询第二页
//                                                page = String.valueOf(intPageNumber);
////                                                    tmpNowStartRecord = tmpNowReadedCount + 1;//记录已经查询的记录个数
//                                                tmpQryNext = true;
//                                            } else if (tmpNowReadedCount == tmpTotalRocords) {//本次分页查询完毕
//                                                break;
//                                            }
//                                        } else {
//                                            tmpRespInfo = "无查询数据";
//                                            break;
//                                        }
//                                    } else {
//                                        tmpRespCode = "-1";
//                                        tmpRespInfo = tmpSbMsg.toString();
//                                        break;
//                                    }
//                                } else {
//                                    tmpRespCode = "-1";
//                                    tmpRespInfo = xln_status + xln_resp_code + xln_resp_desc;
//                                    break;
//                                }
//                            } else {
//                                tmpRespCode = "-1";
//                                tmpRespInfo = tmpStrRet[1];
//                                break;
//                            }
//                        }
//                    } else {
//                        tmpRespCode = "-1";
//                        tmpRespInfo = "签到失败";
//                    }
//                } else {
//                    tmpRespCode = "-1";
//                    tmpRespInfo = "下载银行pub密钥失败";
//                }
//            } else {
//                tmpRespCode = "-1";
//                tmpRespInfo = "下载银行3des密钥失败";
//            }
//        } catch (Exception e) {
//            tmpRespCode = "-1";
//            tmpRespInfo = e.getMessage();
//            e.printStackTrace();
//        }
//        if (tmpRespCode.equals("-1")) {
//            retAts = new RetAts7505HisBalQry(p_req7505.reqHeader);
//            retAts.writeStart();//写返回ATS的统一头部信息
//            retAts.writeRespCode(tmpRespCode);
//            retAts.writeRespInfo(tmpRespInfo);
//        } else if (retAts.getWrittenRdCount() == 0) {
//            retAts.writeRespCode("0");
//            retAts.writeRespInfo("返回结果为空，所查询时间段内不存在历史余额");
//        }
//        retAts.writeEnd();
//        return retAts;
//    }
//
//    public RetAts7506BalQry d_7506_BalQryNew(Req7506BalQry p_req7506) throws Exception {
//        RetAts7506BalQry retAts = new RetAts7506BalQry(p_req7506.reqHeader);
//        retAts.writeStart();//写返回ATS的统一头部信息
//        try {
//            //查询之前做登录操作 下载公钥密钥 进行3des加密 和md5withRSA签名 byte[]数据和String进行base64互转
//            getBnkToken();
////            if (triDesKeys != null && triDesKeys.length != 1024) {
//            if (StringHelper.hasAnyChar(bankFront.token)) {
//                if (new File(String.format("%1$s%2$s_BnkPubKey.txt", strtmpFile, bankFront.org)).exists()) {
//                    if (!"".equals(bankFront.loginFlag) && !"false".equals(bankFront.loginFlag)) {
//                        //赋值通用参数
//                        txCode = "P1CMSER18";
//                        reqSeqID = p_req7506.reqHeader.transSeqID;
//                        XmlTextWriter xmlWriter = new XmlTextWriter();//发银行报文的XML对象
//                        XmlTextWriter xmlWriterWithoutCDATA = new XmlTextWriter();//发银行报文的XML对象
//                        //写入通用的头部节点
//                        writeCommonHeaderWithoutCDATA(xmlWriterWithoutCDATA);
//                        xmlWriterWithoutCDATA.writeStartElement("request");
//
//                        String Ebank = getBankConfig().getValueAsString("ebank");
//                        int TotalNum = p_req7506.detailCount;
//                        xmlWriterWithoutCDATA.writeElementString("ElcSubAR_ID", Ebank);
//                        xmlWriterWithoutCDATA.writeElementString("Rvl_Rcrd_Num", TotalNum + "");
//                        xmlWriterWithoutCDATA.writeElementAttribute("LIST1", "type", "G");
//
//                        Date date = new Date();
//                        int count = 0;
//                        while (p_req7506.readRecord()) {
//                            count++;
//                            xmlWriterWithoutCDATA.writeElementString("Insn_Seq_No", count + "");
//                            xmlWriterWithoutCDATA.writeElementString("Cash_Cst_AccNo", p_req7506.readedDetail.actNum);
//                            xmlWriterWithoutCDATA.writeElementString("CshMgt_Acc_TpCd", p_req7506.readedDetail.savingType);
//                            xmlWriterWithoutCDATA.writeElementString("CcyCd", convertCurToBank(p_req7506.readedDetail.actCur));
//                            xmlWriterWithoutCDATA.writeElementString("BkltNo", "");
//                            xmlWriterWithoutCDATA.writeElementString("Dep_DepSeqNo", "");
//                        }
//                        xmlWriterWithoutCDATA.writeEndElement();
//                        xmlWriterWithoutCDATA.writeElementString("ASPD_ECD", "00000886");//客户内部账户管理
//                        writeComEntityWithoutCDATA(xmlWriterWithoutCDATA);
//                        //重置节点
//                        p_req7506.resetReadMode();
//                        xmlWriterWithoutCDATA.writeEndDocument();
//
//                        int n = xmlWriterWithoutCDATA.toXmlString().length();
//                        xmlLength = decimalFormat.format(n);
//
//                        writeCommonHeader(xmlWriter);
//                        xmlWriter.writeStartElement("request");
//                        xmlWriter.writeElementCDATA("ASPD_ECD", "00000886");//客户内部账户管理
//                        writeComEntity(xmlWriter);
//                        xmlWriter.writeElementCDATA("ElcSubAR_ID", Ebank);
//                        xmlWriter.writeElementCDATA("Rvl_Rcrd_Num", TotalNum + "");
//                        xmlWriter.writeElementAttribute("LIST1", "type", "G");
//
//                        count = 0;
//                        while (p_req7506.readRecord()) {
//                            count++;
//                            xmlWriter.writeElementCDATA("Insn_Seq_No", count + "");
//                            xmlWriter.writeElementCDATA("Cash_Cst_AccNo", p_req7506.readedDetail.actNum);
//                            xmlWriter.writeElementCDATA("CshMgt_Acc_TpCd", p_req7506.readedDetail.savingType);
//                            xmlWriter.writeElementCDATA("CcyCd", convertCurToBank(p_req7506.readedDetail.actCur));
//                            xmlWriter.writeElementCDATA("BkltNo", "");
//                            xmlWriter.writeElementCDATA("Dep_DepSeqNo", "");
//                        }
//                        xmlWriter.writeEndDocument();
//
//                        String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
//                        if (tmpStrRet[0].length() == 0) {
//
//                            StringBuilder tmpSbMsg = new StringBuilder();
//                            XmlTextReader tmpBkReader = null;
//                            tmpBkReader = getBankInfo(tmpStrRet[1], tmpSbMsg);
//                            String xln_status = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_TX_STATUS"); // 服务状态
//                            String xln_resp_code = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_RESP_CODE"); // 服务响应码
//                            String xln_resp_desc = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_RESP_DESC"); // 服务响应描述
//                            if (IsResultInvlid(tmpStrRet[1], tmpBkReader, false, retAts)) {
//                                if (tmpBkReader != null) {
//                                    //SYS_TX_STATUS 服务状态 00-成功01-失败02-不确
//                                    String tmpStatus = tmpBkReader.getFirstText("/Transaction/Transaction_Header/SYS_TX_STATUS");
//                                    //CshMgt_Txn_Rslt_Cd 现金管理交易结果代码 (0-无此交易，1-交易成功，2-交易失败，3-处理中)
//                                    String tmpCode = tmpBkReader.getFirstText("/Transaction/Transaction_Body/response/CshMgt_Txn_Rslt_Cd");
//                                    String tmpStatusText = tmpBkReader.getFirstText("/HZBANKB2C/ebank/common/retMsg");
//                                    while (tmpBkReader.read("/Transaction/Transaction_Body/response/LIST1")) {
//                                        RetAtsBalDetail tmpRetDetail = new RetAtsBalDetail();
//                                        tmpRetDetail.respCode = "0";
//                                        tmpRetDetail.actCur = convertCurToATS(tmpBkReader.readedXElement.getSingleText("CcyCd"));
//                                        tmpRetDetail.actNum = tmpBkReader.readedXElement.getSingleText("Cash_Cst_AccNo");
//                                        tmpRetDetail.currBal = tmpBkReader.readedXElement.getSingleText("Acc_Avl_Bal");
//                                        tmpRetDetail.availBal = tmpBkReader.readedXElement.getSingleText("Acc_Avl_Bal");
//                                        tmpRetDetail.frozenBal = tmpBkReader.readedXElement.getSingleText("Frz_Amt");
//                                        tmpRetDetail.yesterdayBal =tmpBkReader.readedXElement.getSingleText("YstdBl");
//                                        retAts.writeRetDetail(tmpRetDetail, p_req7506.isBatch);
//                                    }
//                                } else {
//                                    retAts.writeRespCode("-1");
//                                    retAts.writeRespInfo(tmpSbMsg.toString());
//                                }
//                            } else {
//                                retAts.writeRespCode("-1");
//                                retAts.writeRespInfo(xln_status + xln_resp_code + xln_resp_desc);
//                            }
//                        } else {
//                            retAts.writeRespCode("-1");
//                            retAts.writeRespInfo(tmpStrRet[1]);
//                        }
//                    } else {
//                        retAts.writeRespCode("-1");
//                        retAts.writeRespInfo("签到失败");
//                    }
//                } else {
//                    retAts.writeRespCode("-1");
//                    retAts.writeRespInfo("下载银行pub密钥失败");
//                }
//            } else {
//                retAts.writeRespCode("-1");
//                retAts.writeRespInfo("下载银行3des密钥失败");
//            }
//        } catch (Exception e) {
//            retAts.writeRespCode("-1");
//            retAts.writeRespInfo(e.getMessage());
//            e.printStackTrace();
//        }
//        retAts.writeEnd();
//        return retAts;
//    }
//
//    /**
//     * 现金池余额查询
//     */
//    private void qry7506CashPoolBal(Map<String, String> mapStr, RetAtsBalDetail tmpRetDetail) {
//        WriteBankLogLn("进入现金池余额查询:" + new Date());
//        txCode = "P1CMSER37";
//        reqSeqID = mapStr.get("transSeqID");
//        try {
//            XmlTextWriter xmlWriter = new XmlTextWriter();//发银行报文的XML对象
//            XmlTextWriter xmlWriterWithoutCDATA = new XmlTextWriter();//发银行报文的XML对象
//            //写入通用的头部节点
//            writeCommonHeaderWithoutCDATA(xmlWriterWithoutCDATA);
//            xmlWriterWithoutCDATA.writeStartElement("request");
//            xmlWriterWithoutCDATA.writeElementString("CcyCd", convertCurToBank(mapStr.get("actCur")));
//            xmlWriterWithoutCDATA.writeElementString("CshEx_Cd", "1".equals(mapStr.get("actCur")) ? "1" : "2");//钞汇代码 1钞人民币 2汇外币
//            xmlWriterWithoutCDATA.writeElementString("Cash_Cst_AccNo", mapStr.get("actNum"));
//            xmlWriterWithoutCDATA.writeElementString("Lqd_AcChar_Ind", "1");
//            xmlWriterWithoutCDATA.writeElementString("ASPD_ECD", "00000886");//客户内部账户管理
//            writeComEntityWithoutCDATA(xmlWriterWithoutCDATA);
//            xmlWriterWithoutCDATA.writeEndDocument();
//            int n = xmlWriterWithoutCDATA.toXmlString().length();
//            xmlLength = decimalFormat.format(n);
//            writeCommonHeader(xmlWriter);
//            xmlWriter.writeStartElement("request");
//            xmlWriter.writeElementCDATA("CcyCd", convertCurToBank(mapStr.get("actCur")));
//            xmlWriter.writeElementCDATA("CshEx_Cd", "1".equals(mapStr.get("actCur")) ? "1" : "2");//钞汇代码 1钞 2汇
//            xmlWriter.writeElementCDATA("Cash_Cst_AccNo", mapStr.get("actNum"));
//            xmlWriter.writeElementCDATA("Lqd_AcChar_Ind", "1");
//            xmlWriter.writeElementCDATA("CCstTr_ID", getBankConfig().getValueAsString("treeId"));
//            xmlWriter.writeElementCDATA("CCstTrNdID", getBankConfig().getValueAsString("treeNdId"));
//            xmlWriter.writeElementCDATA("ASPD_ECD", "00000886");////客户内部账户管理
//            writeComEntity(xmlWriter);
//            xmlWriter.writeEndDocument();
//            String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
//            if (tmpStrRet[0].length() == 0) {
//
//                StringBuilder tmpSbMsg = new StringBuilder();
//                XmlTextReader tmpBkReader = null;
//                tmpBkReader = getBankInfo(tmpStrRet[1], tmpSbMsg);
//                if (tmpBkReader != null) {
//                    while (tmpBkReader.read("/Transaction/Transaction_Body/response")) {
//                        tmpRetDetail.cashPoolAvailBal = tmpBkReader.readedXElement.getSingleText("Acc-Avl-Bal");
//                        tmpRetDetail.cashPoolBal = tmpBkReader.readedXElement.getSingleText("Bal");
//                    }
//                }
//            }
//        } catch (Exception e) {
//            WriteBankLogLn("现金池余额查询异常:" + e.getMessage());
//        }
//    }
//}
